package com.naiterui.ehp.bs.payment.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <pre>
 * 退款表
 * </pre>
 *
 * @author 王泽浩
 * @date 2017年09月09日
 * @since 1.0.0
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "service_refund_info")
public class RefundInfo implements Serializable {

    /**
     * 待退款
     */
    public static final int ORDER_STATUS_WAIT = 1;

    /**
     * 退款成功
     */
    public static final int ORDER_STATUS_SUCCEED = 2;

    /**
     * 退款失败
     */
    public static final int ORDER_STATUS_FAIL = 3;

    /**
     * 全额退款
     */
    public static final int FULL_REFUND = 0;

    /**
     * 部分退款
     */
    public static final int NOT_FULL_REFUND = 1;

    private static final long serialVersionUID = -1766662852967937609L;

    /**
     * The Id.
     */
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    private Long id;

    /**
     * 订单号，不能重复，只能唯一
     */
    @Column(name = "order_sn", nullable = false)
    private String orderSn;

    /**
     * 交易流水单号
     */
    @Column(name = "trade_sn", nullable = false)
    private String tradeSn;

    /**
     * 退款单号
     */
    @Column(name = "refund_order_sn", nullable = false)
    private String refundOrderSn;

    /**
     * 退款金额
     */
    @Column(name = "price", nullable = false)
    private Integer price;

    /**
     * 订单状态 1：待退款，2：已退款，3：退款失败 默认1
     */
    @Column(name = "status", nullable = false)
    private Integer status;

    /**
     * 业务类型 1：个性自定义收费 2：图文咨询收费 3：打赏 4：视频
     */
    @Column(name = "type", nullable = false)
    private Integer type;

    /**
     * 错误编码
     */
    @Column(name = "fail_code")
    private String failCode;

    /**
     * 错误描述
     */
    @Column(name = "fail_msg")
    private String failMsg;

    /**
     * 是否全额退款，0：全额退款 1：部分退款
     */
    @Column(name = "full_refund")
    private Integer fullRefund;

    /**
     * 退款回调通知
     */
    @Column(name = "notify_business_url")
    private String notifyBusinessUrl;
    /**
     * 业务通知状态（0：待通知 1：通知成功 2：通知失败）
     */
    @Column(name = "notify_business_status", nullable = false)
    private Integer notifyBusinessStatus;
    /**
     * 创建时间
     */
    @Column(name = "created_at")
    private Date createdAt;

    /**
     * 创建人
     */
    @Column(name = "created_by")
    private String createdBy;

    /**
     * 修改人
     */
    @Column(name = "changed_by")
    private String changedBy;

    /**
     * 修改时间
     */
    @Column(name = "changed_at")
    private Date changedAt;

    /**
     * 乐观锁
     */
    @Version
    @Column(name = "version")
    private Integer version;

}
